ActiveReports 8 > ActiveReports User Guide > Samples and Walkthroughs > Walkthroughs > Page Report Walkthroughs > Preview > Parameterized Reports |
You can create a parameterized report with ActiveReports and provide an "All" choice for users who want to see all of the data as well as the ability to select multiple values for those who want to see data for several items.
This walkthrough illustrates how to create a report with multivalue parameters and an option to select all of the data.
The walkthrough is split up into the following activities:
![]() |
Note: This walkthrough uses the Movie table from the Reels database. By default, in ActiveReports, the Reels.mdb file is located in the [User Documents folder]\ComponentOne Samples\ActiveReports 8\Data folder. |
When you complete this walkthrough you get a layout that looks similar to the following at design time and at runtime.
![]() |
![]() |
To add an ActiveReport to the Visual Studio project
See Adding an ActiveReport to a Project for information on adding different report layouts.
To connect the report to a data source
To add a dataset to populate the parameter values
SQL Query |
Copy Code
|
---|---|
SELECT -1 AS ProductionID, "(All)" AS Name
FROM Producers
UNION
SELECT ProductionID, Name
FROM Producers;
|
To add a parameter to the report
In the General tab:
In the Available Values tab select From query:
![]() |
Note: The name of the parameter you enter must exactly match the name of the parameter in the linked report, and it is case sensitive. You can pass a value from the current report to the parameter in the Value column of the list. If a value is not supplied for an expected parameter in the linked report, or if the parameter names do not match, the linked report will not run. |
To add a dataset with a parameter
=Parameters!ProductionID.Value
.=Parameters!ProductionID.Value.
SQL Query |
Copy Code
|
---|---|
SELECT Movie.Title, Movie.YearReleased, Movie.UserRating, Producers.Name FROM Producers INNER JOIN (Movie INNER JOIN MovieProducers ON Movie.MovieID = MovieProducers.MovieID) ON Producers.ProductionID = MovieProducers.ProductionID WHERE (MovieProducers.ProductionID IN (?)) OR (-1 IN (?)) ORDER BY MovieProducers.ProductionID, Movie.YearReleased; |
To create a layout for the report
Property Name | Property Value |
---|---|
Location | 0in, 1in |
DataSetName | Movies |
FixedSize (only for FPL reports) | 6.5in, 7.5in |
=Fields!Name.Value
to group all details from each producer.![]() |
Note: You cannot change the name of a table group until after you have set the expression. |
Field | Column | Width |
---|---|---|
Title | TableColumn1 | 3.9in |
YearReleased | TableColumn2 | 1.3in |
UserRating | TableColumn3 | 1.3in |
Property Name | Property Value |
---|---|
FontWeight | Bold |
BackgroundColor | Thistle |
![]() |
Tip: Use the Shift key to select all three text boxes in the group header row, right-click and select Merge Cells to prevent long production company names from wrapping. |
To view the report
OR